<template>
	<div class="header">
		<div class="content-wrapper">
      <div class="avatar">
        <img width="64" height="64" :src="seller.avatar" alt="">
      </div>
      <div class="content">
        <div class="title">
          <span class="brand"></span>
          <span class="name">{{seller.name}}</span>
        </div>
        <div class="description">
          {{seller.description}}/{{seller.deliveryTime}}分钟送达
        </div>
        <div v-if="seller.supports" class="supports">
          <icon-discount  :type="seller.supports[0].type" size="1"></icon-discount>
          <span class="text">{{seller.supports[0].description}}</span>
        </div>
      </div>
      <div v-if="seller.supports" class="supports-count" @click="showDetail">
        <span class="count">{{seller.supports.length}}个</span>
        <i class="icon-keyboard_arrow_right"></i>
      </div>
    </div>
    <div class="bulletin-wrapper" @click="showDetail">
      <span class="bulletin-title"></span>
      <span class="bulletin-text">{{seller.bulletin}}</span>
      <i class="icon-keyboard_arrow_right"></i>
    </div>
    <div class="background">
      <img :src="seller.avatar">
    </div>
    <transition name="fade">
      <div class="detail" v-show="detailShow">
        <div class="detail-wrapper clearfix" >
          <div class="detail-main">
            <h1 class="name">{{seller.name}}</h1>
            <div class="star-wrapper">
              <star :size="48" :score="seller.score"></star>
            </div>
            <detail-title title="优惠信息" v-if="seller.supports"></detail-title>
            <ul v-if="seller.supports">
              <li class="supports-item" v-for="item in seller.supports" >
                <icon-discount v-if="item.type>-1" :type="item.type" size="2"></icon-discount></span>
                <span class="text">{{item.description}}</span>
              </li>
            </ul>
            <detail-title title="商家公告"></detail-title>
            <div class="bulletin">
              {{seller.bulletin}}
            </div>
          </div>
        </div>
        <div class="detail-close" @click="hideDetail"><i class="icon-close"></i></div>
      </div>
    </transition>
	</div>
</template>

<script type="text/ecmascript-6">
 import star from '../star/star.vue'
 import detailTitle from '../detailTitle/detailTitle.vue'
 import iconDiscount from 'components/icon/iconDiscount.vue'
 export default {
   data () {
     return {
       detailShow: false
     }
   },
   methods: {
     showDetail: function () {
       this.detailShow = true
     },
     hideDetail: function () {
       this.detailShow = false
     }
   },
   props: [ 'seller' ],
   created () {
     this.classMap = ['decrease', 'discount', 'special', 'invoice', 'guarantee']
   },
   components: {
     star,
     detailTitle,
     iconDiscount
   }

 }
</script>


<style  lang="stylus" rel="stylesheet/stylus">
@import "../../common/stylus/mixin"

.header
  position: relative
  color: #fff
  background: rgba(7,17,27,0.5)
  overflow: hidden
  .content-wrapper
    position: relative
    padding:24px 12px 18px 24px
    font-size:0
    .avatar
      display: inline-block
      vertical-align: top
      img
        border-radius: 2px
    .content
      display: inline-block
      font-size: 14px
      margin-left 16px
      .title
        margin: 2px 0 8px 0
        .brand
          display: inline-block
          vertical-align: top
          width: 30px
          height: 18px
          bg-image('brand')
          background-size: 30px 18px
        .name
          margin-left: 6px
          font-size: 16px
          line-height: 16px
          font-weight: bold
      .description
        margin-bottom: 10px
        line-height: 12px
        font-size: 12px
      .supports
        .text
          vertical-align: top;
          line-height: 12px
          font-size: 10px
    .supports-count
      position: absolute
      right: 12px
      bottom: 14px
      padding: 8px
      height: 12px
      font-weight: 200
      line-height: 12px
      background: rgba(0,0,0,0.2)
      border-radius: 14px
      .count
        vertical-align: top
        font-size: 10px
      .icon-keyboard_arrow_right
        margin-left: 2px
        line-height: 12px
        font-size: 10px

  .bulletin-wrapper
    background: rgba(7,17,27,0.2)
    position: relative
    height: 28px
    line-height: 28px
    padding: 0 22px 0 12px
    white-space: nowrap
    overflow: hidden
    text-overflow: ellipsis
    font-size: 10px
    .bulletin-title
      display: inline-block
      margin-top: 8px
      width: 22px
      height: 12px
      bg-image('bulletin')
      background-size: cover
    .bulletin-text
      vertical-align: top
    .icon-keyboard_arrow_right
      position: absolute
      font-size: 10px
      right: 12px
      top: 8px

  .background
    position: absolute
    z-index:-1
    top: 0
    left: 0
    width: 100%
    height: 100%
    filter: blur(10px)
    img
      width: 100%
      height: 100%
  .detail
    position: fixed
    z-index: 100
    width: 100%
    height: 100%
    overflow: auto
    top: 0
    left: 0
    background: rgba(7,17,27,0.9)
    -webkit-backdrop-filter: blur(10px)
    &.fade-enter-active, &.fade-leave-active
      transition: all .5s
    &.fade-enter, &.fade-leave-active
      opacity: 0
      background: rgba(7,17,27,0.0)
    .detail-wrapper
      min-height: 100%
      width: 100%
      .detail-main
        margin-top: 64px
        padding-bottom: 64px
        .name
          line-height: 16px
          font-size: 16px
          font-weight: 700
          text-align: center
        .star-wrapper
          margin-top: 18px
          padding: 2px 0
          text-align: center
        .supports-item
          display: block
          box-sizing: border-box
          width: 80%
          padding: 12px 12px 0
          margin: 0 auto
          line-height: 14px
          .text
            font-size: 14px
        .bulletin
          width: 80%
          margin: 0 auto 20px
          padding: 0 12px
          box-sizing: border-box
          line-height: 24px
          font-size: 12px
    .detail-close
      position: relative
      width: 32px
      height: 32px
      margin: -64px auto 0 auto
      clear: both
      font-size: 32px

</style>
